/*
 * switch.c
 *
 * Created: 20/03/2012 12:29:10
 *  Author: Dani
 *
 *
 */ 

#include <avr/io.h>
#include "switch.h"

void SwitchInit()
{
	//Enable switches. PortB.0 output 1
	DDRB |= 0b000000001;
	PORTB |= 0b000000001; 
	//Port D input ( except pin 7)
	DDRD |= 0b00000000;
	// Enable external interrupts 0, 1. (rising edge)
	MCUCR |= 0b00001111;
	GICR |= 0b11000000;
}

uint8_t S3()
{
	if (PINB & 0b00000010) //S3 = PB.1
		return 1;
	else
		return 0;
}
